<template>
  <div>
    <el-input v-model="nv[fvData.fdName]"
              type="textarea"
              :rows = "fvData.fdLayout.rows"
              @blur="lostFocus"
              :disabled="disabled" v-if="nv">
    </el-input>
    <span v-else>当前没有数据来源</span>
  </div>
</template>

<script>
import { computed, onMounted, getCurrentInstance } from 'vue'
import ConstDef from "../../js/ConstDef";
import frontRuleExecutor from "../../js/frule/FrontRuleExecutor";
export default {
  name: 'FvInput',
  props: {
    fvData: {
      default: null,
      type: Object
    }
  },
  setup(props) {
    const nv = computed(() => {
      return props.fvData.getNv();
    });
    const disabled = false;
    const currentInstance = getCurrentInstance();
    onMounted(() => {
      frontRuleExecutor.executeFdLayoutRules(currentInstance, props.fvData, {}, ConstDef.FRONT_RULE_MOUNTED);
    })
    return {
      nv,
      disabled
    }
  },
  methods: {
    lostFocus() {
      frontRuleExecutor.executeFdLayoutRules(this, this.fvData, {}, ConstDef.FRONT_RULE_LOST_FOCUS);
    }
  }
}
</script>

<style scoped>

</style>
